<?php
    ?>
<?php if ( is_array($customers)){ ?>
<div class="clear"></div>
<div>
            <table id="js_table_layout" style="width: 100%">
                    <thead>
                            <tr>
                                    <th style="width: 15%;text-align: left; text-indent: 5px;">KundenNr.</th>
                                    <th style="width: 8%; text-align: left; text-indent: 5px;">Anrede</th>
                                    <th style="width: 15%; text-align: left; text-indent: 5px;">Nachname</th>
                                    <th style="width: 20%; text-align: left; text-indent: 5px;">Vorname</th>
                                    <th style="width: 6%; text-align: left; text-indent: 5px;">Geburtsdatum</th>
                                    <th style="width: 11%; text-align: left; text-indent: 5px;">&nbsp;</th>
                            </tr>
                    </thead>
                    <tbody>
    <?php
    
    foreach ( $customers as $customer_row ){
        if ($customer_row['geburtsdatum'] != "") {
            $gebDatum = date("d.m.Y" , strtotime($customer_row['geburtsdatum']));
        }else{
            $gebDatum = '-';
        }
    ?>
                            <tr>
                                    <td style="text-indent: 10px;"><?= $customer_row['kundenNr'] ?></td>
                                    <td style="text-indent: 10px;"><?= ucwords($customer_row['anrede']) ?></td>
                                    <td style="text-indent: 10px;"><?= ucwords($customer_row['nachname']) ?></td>
                                    <td style="text-indent: 10px;"><?= ucwords($customer_row['vorname']) ?></td>
                                    <td style="text-align: center;"><?= $gebDatum ?></td>
                                    <td style="text-align: center;">
                                        <a href="?page=<?= $param ?>&kunden-nr=<?= $customer_row['idKunde'] ?>">Ausw&auml;hlen</a>
                                    </td>
                            </tr>
    <?php
    }
    ?>
                    </tbody>
            </table>
</div>
<script lang="JavaScript">
        $(document).ready(function() {
            $('#js_table_layout').dataTable();
//            $('#js_table_layout').flexigrid({height:'auto',striped:false});

        } );
</script>
<?php
} //end if ( count($customers) > 0 ){
else{
?>
<div class="display-errors-label">
    <p>Es sind keine Einträge für diesem Bereich vorhanden</p>
</div>
<?php
}
?>
